\ Preprocessor closures - Copyright 2012 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

\ WARNING! Incompatible with FOOS.4PP

[DEFINED] allocate [IF]
  [DEFINED] forcecellheap [IF]
    : (~~alloc) allocate abort" Out of heap space" ;
  [THEN]
[THEN]

: (~~@exec) dup @ execute ;
:macro (.size) >1> ~~ |#| ; :macro (.sizeof) @1@ >1> (.size) @1@ ;
:macro :: : @1@ #1# ;
:macro fields struct 1+ ; :macro end-fields end-struct (.size) ;
:macro static (.sizeof) array #1# #1# <1< #1# does> (~~@exec) ` ;` ;

:macro new 
  (.sizeof) (~~alloc) dup variable #1# #1# <1< ! #1# does> @ (~~@exec) ` ;`
;